Skip to content

Conversation

steffenlarsen
Copy link
Contributor

This commit adds two new experimental parts:

  1. A new UR function urProgramDynamicLinkExp for dynamically linking binaries in built programs. Support for this can be checked by querying UR_DEVICE_INFO_DYNAMIC_LINK_SUPPORT_EXP.
  2. A new flag enum ur_exp_program_flags_t used by exp-multi-device-compile functions. This enum currently only has a single flag UR_EXP_PROGRAM_FLAG_ALLOW_UNRESOLVED_SYMBOLS which instructs the urProgramLinkExp function that unresolved external symbols should be allowed after linking.

This commit adds two new experimental parts:
 1. A new UR function `urProgramDynamicLinkExp` for dynamically linking
    binaries in built programs. Support for this can be checked by
    querying `UR_DEVICE_INFO_DYNAMIC_LINK_SUPPORT_EXP`.
 2. A new flag enum `ur_exp_program_flags_t` used by
    exp-multi-device-compile functions. This enum currently only has a
    single flag `UR_EXP_PROGRAM_FLAG_ALLOW_UNRESOLVED_SYMBOLS` which
    instructs the `urProgramLinkExp` function that unresolved external
    symbols should be allowed after linking.

Signed-off-by: Larsen, Steffen <[email protected]>
pDdiTable->pfnBuildExp = urProgramBuildExp;
pDdiTable->pfnCompileExp = nullptr;
pDdiTable->pfnLinkExp = nullptr;
pDdiTable->pfnDynamicLinkExp = nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the offload adapter not provide a value for UR_DEVICE_INFO_DYNAMIC_LINK_SUPPORT_EXP as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good eye! I totally missed this. Most likely because I grepped for UR_DEVICE_INFO_MULTI_DEVICE_COMPILE_SUPPORT_EXP which isn't covered by the offload adapter currently. Neither is UR_DEVICE_INFO_USM_P2P_SUPPORT_EXP I've noticed.

Signed-off-by: Larsen, Steffen <[email protected]>
@steffenlarsen steffenlarsen requested a review from a team as a code owner October 3, 2025 08:33
@steffenlarsen steffenlarsen changed the title [UR] Add dynamic linking and program flags [SYCL][UR] Add dynamic linking and program flags Oct 3, 2025
Copy link
Contributor

@pbalcer pbalcer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UR lgtm.

Comment on lines +586 to +589
for (uint32_t I = 0; I < count; ++I)
if (phPrograms[I]->hasZeModuleForDevice(Device->ZeDevice))
ZeModules.push_back(
phPrograms[I]->getZeModuleHandle(Device->ZeDevice));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please add {}. I found this difficult to parse.

Comment on lines +594 to +595
// TODO: What should be done with the log? Since there is no result
// program, what can it be attached to?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably revisit this design with build log being returned by an info query. Instead we should do what L0 does, and just return the log as an optional output parameter.
For now, just leave the TODO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants